<template>
  <el-table
    :data="tableData"
    border
    :height="$store.state.app.tableHeight"
    style="width: 100%;font-size:12px"
  >
    <el-table-column
      prop="id"
      label="ID"
      width="50"
    />
    <el-table-column
      label="授权名"
      width="70"
    >
      <template slot-scope="scope"> {{ scope.row.anent_content.anent_name }}</template>
    </el-table-column>
    <el-table-column
      label="手机号"
      width="100"
    >
      <template slot-scope="scope"> {{ scope.row.anent_content.brand_phone }}</template>
    </el-table-column>
    <el-table-column
      label="微信号"
      width="90"
    >
      <template slot-scope="scope"> {{ scope.row.anent_content.anent_login_name }}</template>
    </el-table-column>
    <el-table-column
      label="品牌名"
    >
      <template slot-scope="scope"> {{ scope.row.brand_content.brand_name }}</template>
    </el-table-column>
    <el-table-column
      label="级别名"
      width="90"
    >
      <template slot-scope="scope"> {{ scope.row.anent_brand_content.level_name.level_name }}</template>
    </el-table-column>
    <el-table-column
      label="链接生成时间"
      width="120"
    >
      <template slot-scope="scope">
        {{ getTime(scope.row.create_time) }}
      </template>
    </el-table-column>
    <el-table-column
      label="剩余时间(秒)"
      width="60"
    >
      <template slot-scope="scope">
        {{ scope.row.close_time - Date.parse(new Date())/1000 &lt;= 0 ? "0" : scope.row.close_time - Date.parse(new Date())/1000 }}
      </template>
    </el-table-column>
    <el-table-column
      label="状态"
      width="60"
    >
      <template slot-scope="scope">
        {{ scope.row.status === "0" ? '正常' : '过时' }}
      </template>
    </el-table-column>
    <el-table-column
      prop="see"
      label="打开次数"
      width="50"
    />
    <el-table-column
      prop="register"
      label="申请次数"
      width="50"
    />
  </el-table>
</template>

<script>
import { timestampToDate } from '@/utils/index'
export default {
  props: {
    tableData: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {
    }
  },

  methods: {
    getTime(timestamp) {
      return timestampToDate(timestamp, 1)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
